import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:share_fit/app/controllers/home/exercise_records/logic.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/app/models/home/date_type_enum.dart';
import 'package:share_fit/generated/locales.g.dart';

class BottomCard extends StatelessWidget {
  BottomCard({super.key});

  final logic = Get.find<ExerciseRecordsLogic>();

  @override
  Widget build(BuildContext context) {
    DateTime now = DateTime.now();
    return Container(
      height: 250.h,
      color: Colors.white,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          GestureDetector(
            onTap: () => logic.changeDateType(type: DateType.week),
            child: Wrap(
              direction: Axis.vertical,
              spacing: 15.w,
              crossAxisAlignment: WrapCrossAlignment.center,
              children: [
                SizedBox(
                  height: 100.w,
                  width: 100.w,
                  child: Stack(
                    alignment: Alignment.center,
                    children: [
                      CircularProgressIndicator(
                        strokeWidth: 5.w,
                        strokeCap: StrokeCap.round,
                        backgroundColor: Colors.grey.withOpacity(0.3),
                        valueColor: const AlwaysStoppedAnimation(Colors.blue),
                        value: 0,
                      ),
                      Text('${now.weekday}', style: TextStyle(fontSize: 36.sp)),
                    ],
                  ),
                ),
                Text(LocaleKeys.time_unit_week.ts),
              ],
            ),
          ),
          GestureDetector(
            onTap: () => logic.changeDateType(type: DateType.month),
            child: Wrap(
              direction: Axis.vertical,
              spacing: 15.w,
              crossAxisAlignment: WrapCrossAlignment.center,
              children: [
                SizedBox(
                  height: 100.w,
                  width: 100.w,
                  child: Stack(
                    alignment: Alignment.center,
                    children: [
                      CircularProgressIndicator(
                        strokeWidth: 5.w,
                        strokeCap: StrokeCap.round,
                        backgroundColor: Colors.grey.withOpacity(0.3),
                        valueColor: const AlwaysStoppedAnimation(Colors.blue),
                        value: 0,
                      ),
                      Text('${now.month}', style: TextStyle(fontSize: 36.sp)),
                    ],
                  ),
                ),
                Text(LocaleKeys.time_unit_month.ts),
              ],
            ),
          ),
          GestureDetector(
            onTap: () => logic.changeDateType(type: DateType.year),
            child: Wrap(
              direction: Axis.vertical,
              spacing: 15.w,
              crossAxisAlignment: WrapCrossAlignment.center,
              children: [
                SizedBox(
                  height: 100.w,
                  width: 100.w,
                  child: Stack(
                    alignment: Alignment.center,
                    children: [
                      CircularProgressIndicator(
                        strokeWidth: 5.w,
                        strokeCap: StrokeCap.round,
                        backgroundColor: Colors.grey.withOpacity(0.3),
                        valueColor: const AlwaysStoppedAnimation(Colors.blue),
                        value: 0,
                      ),
                      Text('${now.year}', style: TextStyle(fontSize: 36.sp)),
                    ],
                  ),
                ),
                Text(LocaleKeys.time_unit_year.ts),
              ],
            ),
          ),
          GestureDetector(
            onTap: () => logic.changeDateType(type: DateType.all),
            child: Wrap(
              direction: Axis.vertical,
              spacing: 15.w,
              crossAxisAlignment: WrapCrossAlignment.center,
              children: [
                Image.asset('assets/images/home/more.png', width: 100.w, height: 100.w),
                Text(LocaleKeys.exercise_records_all.ts),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
